package com.neuqsoft.rd.citizen.thirdapp.demo.api;

import com.neuqsoft.rd.citizen.thirdapp.demo.dto.OrderResultDTO;
import com.neuqsoft.rd.citizen.thirdapp.demo.dto.UserLoginDTO;
import com.neuqsoft.rd.citizen.thirdapp.demo.service.Scene3Service;
import com.neuqsoft.rd.citizen.thirdapp.sdk.dto.NeuqOrderStateRsp;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author baidh
 * @date 2020/12/02
 */
@Api(tags = "线上购票")
@RestController
@RequestMapping("/api/scene3/")
public class Scene3Api {

    @Autowired
    Scene3Service service;

    @GetMapping("/token")
    public UserLoginDTO oauthToken(@RequestParam String code, @RequestParam(required = false) String redirectUri) {
        return service.oauthToken(code, redirectUri);
    }

    @PostMapping("/pay")
    public OrderResultDTO onlinePay(@RequestParam String authToken) {
        return service.onlinePay(authToken);
    }

    @GetMapping("/pay/state")
    public NeuqOrderStateRsp tradeState(@RequestParam String bizNo) {
        return service.tradeState(bizNo);
    }

}
